package com.yuanchu.store.controller;

import com.yuanchu.common.utils.R;
import com.yuanchu.store.entity.YoshopExpressEntity;
import com.yuanchu.store.service.YoshopExpressService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description:
 * @date: 2024-02-18 13:01
 */
@Api(tags = "店铺快递接口", value = "StoreExpressController")
@RestController
@RequestMapping("express")
public class StoreExpressController {

    @Resource
    private YoshopExpressService expressService;

    @GetMapping("/list")
    public R queryExpressList() {
        List<YoshopExpressEntity> expressList = expressService.queryExpressList();
        Map<String, Object> data = new HashMap<>();
        data.put("list", expressList);
        return R.ok().put("data", data);
    }

    @GetMapping("/{expressId}")
    public YoshopExpressEntity queryExpressById(@PathVariable("expressId") Integer expressId) {
        return expressService.getById(expressId);
    }
}
